-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 2.0.0: Major Update with Enhanced Extensibility and Improved Typing #45
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Refactored file structure for improved organization and maintainability. - Added support for custom parsers, allowing users to create and integrate their own color models. - Enhanced TypeScript definitions for better type safety and developer experience. - Streamlined core methods to include only essential getters: luminance, rgb, hsl, hsv, cmyk, alpha, hue, along with source and error properties. - Introduced built-in plugins for common transformations: invert, lighten, darken, saturate, desaturate, toCmyk, toHex, toHsl, toHsv, toRgb. - Achieved 100% test coverage with new Jest tests, ensuring reliability and stability of the library. This refactor improves usability, extensibility, and performance while maintaining strong type safety.
- Introduced sections detailing the creation and usage of custom parsers with the dye() function. - Included examples for the HSL and HEX parsers, showcasing color parsing and transformation. - Provided best practices for regex and extract functions, emphasizing clarity and valid RGB output. - Added tips for maintaining consistency in color channel extraction and serialization.
- Removed `y` flag from regex expressions to prevent unintended lastIndex behavior across multiple matches. - Added a reset of `lastIndex` in the ColorParser class to ensure consistent regex execution and prevent zeroed outputs on repeated calls with identical inputs.
…d `dye` modules - Updated tests to include validation for potential lastIndex-related issues in regex-based operations. - Ensured consistent behavior across multiple calls with identical inputs to prevent regression.
- Replaced the old method of converting hex color strings to RGB with a new approach that utilizes a single call to Number.parseInt(). - The new method improves performance significantly, reducing the average conversion time from 228.3 ns to 82.6 ns, making it 2.77x faster. - The function now extracts RGB and alpha values using bitwise operations, enhancing efficiency and maintaining clarity. - Added input validation to ensure hex strings are in the correct format (6 or 8 characters). - Removed hexToInt() utility since it's not required anymore. This change is crucial for improving the performance of color processing in the application.
supitsdu
added
✨ Enhancement
New feature or request
♻️ Refactor
Code refactoring, restructuring, or improving code quality without changing external behavior
💎 Code Quality
Improving code style, maintainability, or performance
labels
Nov 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
💎 Code Quality
Improving code style, maintainability, or performance
✨ Enhancement
New feature or request
♻️ Refactor
Code refactoring, restructuring, or improving code quality without changing external behavior
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR finalizes the 2.0.0 release of Colorus.js, introducing substantial enhancements for extensibility, improved performance, and developer experience. Key changes include customizable parsers, a refined plugin system, comprehensive type improvements, and refactored core methods. This update is backward-compatible at the API level but brings structural improvements for advanced usage.
Key Changes
Plugin and Parser System:
lighten
,invert
).File Structure Refactor:
Enhanced TypeScript Support:
Core Method Improvements:
dye
function to support parser and plugin options.Extensive Testing:
Fixes and Quality of Life Improvements
Breaking Changes
While the primary API remains the same, structural changes to the internal plugin and parser systems may require updating custom plugins created for previous versions.
Checklist
Closes #44